Skip to content

Comments

libwebsocket: add missing $webSockets dependency#26318

Open
subhaushsingh wants to merge 2 commits intoemscripten-core:mainfrom
subhaushsingh:fix-websocket-deps
Open

libwebsocket: add missing $webSockets dependency#26318
subhaushsingh wants to merge 2 commits intoemscripten-core:mainfrom
subhaushsingh:fix-websocket-deps

Conversation

@subhaushsingh
Copy link

@subhaushsingh subhaushsingh commented Feb 21, 2026

emscripten_websocket_new uses $webSockets but does not declare it as a dependency.
In non-MAIN_MODULE builds, this allows $webSockets to be removed by dead code elimination, leading to a runtime error.

This patch adds:

emscripten_websocket_new__deps: ['$webSockets'],

to ensure $webSockets is retained when emscripten_websocket_new is linked.

This restores correct behavior without requiring -sMAIN_MODULE=1.

Fixes: #26310

@subhaushsingh
Copy link
Author

@sbc100 I've added a regression test for emscripten_websocket_new to cover the missing $webSockets dependency issue.
Please let me know if any adjustments are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

emscripten websocket API: webSockets global not created unless building with -sMAIN_MODULE=1

1 participant